package cn.niit.diy;

import org.aspectj.lang.annotation.*;
@Aspect
public class AnnotationPointCut {

    final String EXECUTION = "execution(* cn.niit.impl.UserServiceImpl.*(..))";

    @Before(EXECUTION)
    public void before(){
        System.out.println("[AnnotationPointCut.before ]..... 前置通知方法执行" );
    }

    @After(EXECUTION)
    public void after(){
        System.out.println("[AnnotationPointCut.after ].....后置通知方法执行" );
    }

    @AfterReturning(EXECUTION)
    public Object afterReturning(){
        System.out.println("【AnnotationPointCut.afterReturning()】后置通知：方法执行前.......");
        return new Integer(1);
    }

    @AfterThrowing(EXECUTION)
    public void afterThrowing(){
//        第二步：在Spring配置文件中，注册bean，并增加支持注解的配置
//        aop:aspectj-autoproxy：说明
        try {

        }catch (Throwable e){

        }
        System.out.println("【AnnotationPointCut.afterThrowing()】异常通知：发生异常后执行.......");
    }
}
